<template>
	<view class="content " :style="{paddingTop: yemiangao+'px'}">

		<view class="d-kuan-juzhong ">
			<!--头部-->
			<view class="d-kuan pc-dingbu">
				<DToubu 
				ref="dToubu" 
				@login-success="handleLoginSuccess"
				@clear-audio="clearAllAudio" 
				@logout-success="handleLogout"
				:dengluxianshi="denglu_xianshi"
				@update-dengluxianshi="handleUpdateDengluxianshi"
				@www-data="wwwdataget"
				></DToubu>
			</view>

			<!--头部-->
			<!--下面内容-->
			<view class="d-kuan d-clear">
				<uv-row customStyle="margin-bottom: 10px" :gutter="10">
					<uv-col span="2" class="pc-yincang">
						
					</uv-col>
					<uv-col :span="kuan_shu" id="daohangkuan" >
						<view class="d-kuan ">
							<view class=" ">

								<view class="d-fanhui-40 d-you-10 d-zuo" @click="fanhui">
									<uv-icon name="arrow-left" color="#000000" size="18"></uv-icon>
								</view>
								<view class="d-you" style="margin-right: 30rpx;line-height: 80rpx;">
									<view class="d-wenzi-12">
										可以申请<text class="d-jiacu" style="color: #05957f;"> {{ u_data.keshenqing }} </text>个圈子，已经申请<text class="d-jiacu" style="color: #05957f;"> {{ u_data.quanzi }} </text>个
										<text @click="vip()" style="color: #ffffff;background-color: #05957f; padding: 10rpx;border-radius: 8rpx;" class="d-wenzi-12 d-zuo-10 d-jiacu d-yuanjiao-5">
											升级
										</text>

									</view>

								</view>
							</view>
						</view>
						<view class="d-kuan ">
							<view class="pc-neikuang-20 d-piaofu-shenqing-00" >
								
							    <view class="d-beijing-baise d-yuanjiao-10 d-bianhua-10" :style="{height: leftNavHeight}">
									<view class="d-clear"></view>
									<uv-cell-group>
										<uv-cell v-for="(list,index) in shenquan_list" :key="index"  icon="more-circle" :title="list.content && list.content.title+' 圈子'">
											<!-- 自定义左侧标题下面的内容 -->
											<template v-slot:label>
												<text style="font-size: 28rpx;color: #999;">
													{{ list.content && list.content.inputtime }} 
												</text>
											</template>
											<!-- 自定义右侧值 -->
											<template v-slot:value>
												<text>待审核</text>
											</template>
										</uv-cell>
										<!--显示没有数据，提示用户申请圈子-->
									</uv-cell-group>
									<view v-if="shenquan_list.length === 0" class="d-kuan d-juzhong d-shang-10" >
										暂没有申请圈子
									</view>


								</view>
							
							
							
							
						</view>
						</view>
					</uv-col>
					<uv-col span="3" class="pc-yincang">
						

					</uv-col>
				</uv-row>

				

			</view>
			<!--下面内容-->

		</view>
	</view>
</template>

<script>
    import Api from '@/utils/api.js';
	import QuanApi from '@/utils/quan_api.js';
	import UApi from '@/utils/u_api.js';

	//var wxRequest_2 = require("../../utils/wxRequest.js");
	import { getRequest,postRequest } from '@/utils/wxRequest.js';
    //引入组件 d-toubu
    import DToubu from '@/components/d-toubu/d-toubu.vue'
	import Ddaohang from '@/components/d-daohang/d-daohang.vue'
	export default {
		data() {
			return {
				id:'',
				title: '',
				neirong:'',
				jiage:'', // 加入圈子费用
				tianshu:'', // 加入圈子时间

				leftNavHeight: '0rpx', // 默认高度
				daohangkuanzhi: '50%', // 默认值
				rightColWidth: '300px', // 默认宽度
				rightColLeft: '0px', // 添加这个属性
				daohang_top:'60',

				
				denglu_xianshi:0, // 登录显示
				erjidata:[],
				erjiindex:'',//当前激活的二级菜单索引
				activeIndex: -1, // 当前激活的一级菜单索引
				quan_daohang_list:[], // 知识导航列表
				zhishi_list:[], // 知识列表
				xuanzezhi:0, // 知识列表
				daohanggaoHeight: '54px', // 导航栏高度

				currentPage: 1, //下拉加载
    			pageSize: 12, //下拉加载
    			isLoading: false, //下拉加载
    			noMoreData: false, //下拉加载
				kuan_shu: 8, //格大小
				kuan_quan:6,//格大小
				yemiangao:70, //顶部导航栏
			//上传图片
			fileList1: [],//图片存储
			fabuid:{},//发布id
			uptu:[],
			wwwdata:{},
			u_data:[], //用户信息
			//双击检测时间戳
			jiageLastTap: 0, //加圈价格输入框上次点击时间
			tianshuLastTap: 0, //加圈天数输入框上次点击时间
			shenquan_list:[], // 申请的圈子列表

			}
		},
		components: {
  		    DToubu,
			Ddaohang
  		},
		computed: {
		  	yidenglu() {
		  	  return (this.$store.state.memberuid && this.$store.state.keycode) ? 1 : 0;
		  	},
		  	touxiang() {
		  	  return this.$store.state.member? this.$store.state.member.avatar : '';
		  	},
		  	name1() {
		  	  return this.$store.state.member? this.$store.state.member.name : '';
		  	},
			uid() {
		  	  return this.$store.state.memberuid;
		  	},
		  	keycode() {
		  	  return this.$store.state.keycode;
		  	}
		},

		onReachBottom() {
  			// this.onReachBottom(); //下拉加载分页
  		},
		mounted() {
			//var m = this.$store.state;
			//console.log('mmmm',m);
			
    	    this.setLeftNavHeight();
			this.getRightColWidth(); // 添加这行
			
    	    // 添加窗口大小变化监听
    	    window.addEventListener('resize', this.setLeftNavHeight);
			window.addEventListener('resize', this.getRightColWidth); // 添加窗口大小变化监听
			this.$nextTick(() => {
				// 计算高度
				//this.calcDaohanggaoHeight();
    		});

    	},
    	beforeDestroy() {
    	    // 移除监听
    	    window.removeEventListener('resize', this.setLeftNavHeight);
			window.removeEventListener('resize', this.getRightColWidth); // 添加这行
			
    	},
		onShow() {
			//var m = this.$store.state;
			//console.log('12300000:', this.$store.state.memberuid);
			//this.quan_daohang_api();
			//this.getFabuid_api();
			this.getu_api(); 
			this.getShenqing_uid_list_api(); // 申请的圈子统计
			/*var e = this;
			this.zhishi_list_api(e,false);*/
		},
		onLoad(e) {
			// 获取URL参数
			//this.id = e.id || '';
			//console.log('圈子id',this.id);
			
		},
		methods: {
			clearJiage() {
				console.log('清空加入圈子费用');
				this.jiage = '';
			},
			clearTianshu() {
				console.log('清空加入圈子时间');
				this.tianshu = '';
			},
			// 加入圈子费用输入框
		handleJiageInput(e) {
			// 安全获取值，处理没有event对象的情况
			let value = this.jiage;
			// 检查是否有event对象，并且正确访问target.value
			if (e && e.target) {
				value = e.target.value;
			}
			
			// 如果值为undefined或null，设为空字符串
			if (value === undefined || value === null) {
				value = '';
			}
			
			// 检查是否包含非法字符（非数字和非小数点）
			// 检查是否有非法字符
			const hasInvalidChar = /[^0-9.]/.test(value);
			// 检查是否有多个小数点
			const hasMultipleDots = (value.match(/\./g) || []).length > 1;
			
			// 清理输入：只保留数字和小数点
			let cleanValue = value.replace(/[^0-9.]/g, '');
			
			// 确保只有一个小数点
			/*if (hasMultipleDots || cleanValue.split('.').length > 2) {
				const parts = cleanValue.split('.');
				cleanValue = parts[0] + '.' + parts.slice(1).join('');
			}*/
			
			// 限制小数点后最多两位
			cleanValue = cleanValue.replace(/\.(\d{2})\d*/g, '.$1');
			
			// 如果有非法输入，弹出提示
			if (hasInvalidChar) {
				this.jiage = cleanValue;
				uni.showToast({
					title: '只能输入数字和小数点',
					icon: 'none'
				});
			}
			
			// 始终更新值，确保任何非法字符都被清理
			this.jiage = cleanValue;
		},
		// 处理加圈价格输入框的点击事件，检测双击
		handleTapJiage() {
			// 记录当前点击时间
			const currentTime = new Date().getTime();
			// 获取上次点击时间
			const lastTapTime = this.jiageLastTap || 0;
			// 设置双击时间间隔阈值（200-300ms）
			const doubleTapThreshold = 300;
			
			// 如果两次点击时间间隔小于阈值，则认为是双击
			if (currentTime - lastTapTime < doubleTapThreshold) {
				// 清空输入框
				this.jiage = '';
			}
			
			// 更新上次点击时间
			this.jiageLastTap = currentTime;
		},
		// 处理加圈天数输入框的点击事件，检测双击
		handleTapTianshu() {
			// 记录当前点击时间
			const currentTime = new Date().getTime();
			// 获取上次点击时间
			const lastTapTime = this.tianshuLastTap || 0;
			// 设置双击时间间隔阈值（200-300ms）
			const doubleTapThreshold = 300;
			
			// 如果两次点击时间间隔小于阈值，则认为是双击
			if (currentTime - lastTapTime < doubleTapThreshold) {
				// 清空输入框
				this.tianshu = '';
			}
			
			// 更新上次点击时间
			this.tianshuLastTap = currentTime;
			
			// 限制小数点后最多两位
			value = value.replace(/\.(\d{2})\d*/g, '.$1');
			
			// 更新值
			this.jiage = value;
		},
			yiji2(index) {
				this.xuanzezhi = 0;
				this.id = index.id;
				console.log('一级分类id',this.id);
				console.log(this.xuanzezhi);
    		  // 切换激活的一级菜单
			  setTimeout(() => {

    			  	this.activeIndex = index;
    			  	// 根据激活的一级菜单显示对应的二级菜单
				  	if(index.id == 0){
						  this.erjidata = [];
				  	}else{
						  this.erjidata = this.quan_daohang_list[index.index].son;
						  
				  	}
				  	const data = {
						  categories:index.id,
						  page: 1 // 重置页码
				  	}
					this.currentPage = 1; // 重置页码
					this.noMoreData = false; // 重置无更多数据标志
				  	
					  this.calcDaohanggaoHeight();
				}, 300);
    		  
			  
    		},
			erji2(index) {
				this.xuanzezhi = index.index;
				this.id = index.id;
				console.log('二级分类id',this.id);

    		  // 切换激活的二级菜单
    		  this.erjiindex = index.id;
			  this.activeIndex = index;

			  const data = {
				  categories:index.id,
				  page: 1 // 重置页码
			  }
			    this.currentPage = 1; // 重置页码
				this.noMoreData = false; // 重置无更多数据标志

			  
			  //console.log('二级分类：',index);

    		},
			// 发布登录
			denglu_fabu(){
				if(this.yidenglu == 0){
					this.denglu_xianshi = 1;
				} else {
					this.denglu_xianshi = 0;	
				}
				
				console.log('发布登录',this.denglu_xianshi);
				
			},
			// 更新判断是否登录
			handleUpdateDengluxianshi(value) {
			  	this.denglu_xianshi = value;
			  	console.log('关闭登录',this.denglu_xianshi);
			},
			// 退出登录
			handleLogout() {
 			  // 用户退出时关闭阅读界面
 			  this.yuedu = false;

 			  // 停止并销毁音频
 			  if(this.$refs.audioPlayer) {
 			    const audioCtx = this.$refs.audioPlayer.getAudioContext();
 			    audioCtx.stop();
 			    audioCtx.destroy();
 			  }
			   //this.getDianzan_panduan_api(); // 退出登录后重新获取点赞状态
			   //this.getShoucang_panduan_api(); // 退出登录后重新获取收藏判断
 			},
			// 登录
			handleLogin() {
				//this.getDianzan_panduan_api(); // 登录后重新获取点赞状态
				//this.getShoucang_panduan_api(); //登录后重新获取收藏判断
			},



			getRightColWidth() {
				// 获取系统信息
				const query_2 = uni.createSelectorQuery().in(this);
				const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowWidth = systemInfo.windowWidth;
				var d = this;            
               this.$nextTick(() => {
					if(windowWidth >=920){
						query_2.select('#daohangkuan').boundingClientRect(data => {
    		    		    if (data) {
    		    		        this.daohangkuanzhi = `${data.width-150}px`;
    		    		    }
    		    		}).exec();

						d.gao = 20;
						d.kuan_shu = 7;
						d.kuan_quan = 6;
						d.swiperHeight = '250';
						d.daohang_top = '60';
						d.yemiangao = '70';
					} else {
						d.gao = 10;
						d.kuan_shu = 12;
						d.kuan_quan = 12;
						d.swiperHeight = '120';
						d.daohang_top = '80';
						d.yemiangao = '0';
						this.daohangkuanzhi = '100%'; // 或其他适合的默认值


					}

                 const query = uni.createSelectorQuery().in(this);
                 query.select('#youbiankuan').boundingClientRect(rect => {
                   if (rect) {
                     /*this.rightColWidth = `${rect.width+20}px`;
                     console.log('右侧列宽度:', this.rightColWidth);*/
					 	this.rightColWidth = `${rect.width-80}px`;
                    	this.rightColLeft = `${rect.left}px`; // 计算左侧位置
                    	console.log('右侧列位置:', this.rightColWidth);
                   }
                 }).exec();
               });
            },

			calcDaohanggaoHeight() {
				this.$nextTick(() => {

    		    	const query = uni.createSelectorQuery().in(this);
    		    	query.select('#daohanggao').boundingClientRect(data => {
    		    	    if (data) {
    		    	        this.daohanggaoHeight = `${data.height}px`;
							console.log('导航栏高度:', this.daohanggaoHeight);
    		    	    }
    		    	}).exec();
				});
    		},

			//首页
			shouye(){
				uni.navigateTo({
					url: '/pages/index/index',
					fail: (err) => {
						console.error('跳转失败:', err)
					}
				})
			},
			

			toggleErji(index) {
				
    		  if (this.activeIndex === index) {
    		    // 点击已激活的菜单，收起二级菜单
    		    this.activeIndex = -1;
    		    this.currentErji = [];
    		  } else {
    		    // 点击新的菜单，显示对应的二级菜单
    		    this.activeIndex = index;
    		    this.currentErji = this.zhishi_daohang_list[index].erji;
    		  }
    		},
			setLeftNavHeight() {
        	    // 获取系统信息
        	    const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowHeight = systemInfo.windowHeight;
        	    const headerHeight = 70; // 头部高度估计值
        	    const calculatedHeight = windowHeight - headerHeight;
				
        	    // 设置左边导航高度
        	    this.leftNavHeight = `${calculatedHeight}px`;
        	},
			
			
			handleLoginSuccess() {
  			  this.$forceUpdate();
  			},
			// 返回
            fanhui() {
				
               // 获取页面栈
                 const pages = getCurrentPages();
                 // 如果页面栈长度小于等于1，说明没有上一级页面
                 if (pages.length <= 1) {
                    console.log('没有上一级页面');
                    uni.reLaunch({
                      url: '/pages/index/index'
                    });
                 } else {
                    // 有上一级页面则返回
                    uni.navigateBack({
                      delta: 1
                    });
                }
            },
			// 导航接口
			quan_daohang_api(){
				var get_data = getRequest(Api.getQuan_daohang());
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						//var list = res.data ? res.data.data : {};
						var list = res.data && res.data.data ? res.data.data.lisi2 : [];
						
						
        				this.quan_daohang_list = list;
						console.log(list);
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})
			},
			//申请圈子
			shenqing(){
				// 如果id为空
				if(!this.id || !this.title || !this.neirong){

					uni.showToast({
						icon: 'none',
						title: '请填写圈子信息'
					});
					return;
				}
				// 判断jiage是否为空
				if(!this.jiage){
					uni.showToast({
						icon: 'none',
						title: '请填写加入圈子费用'
					});
					return;
				}
				//判断tianshu是否为空
				if(!this.tianshu){
					uni.showToast({
						icon: 'none',
						title: '请填写加入圈子天数'
					});
					return;
				}
				// 弹出确定
				uni.showModal({
					title: '提示',
					content: '确定信息正确吗？',
					success: (res) => {
						if (res.confirm) {
							// 点击确定后的操作
							console.log('用户点击了确定');
							this.shenqing_api();
						} else if (res.cancel) {
							// 点击取消后的操作
							console.log('用户点击了取消');
						}
					}
				});
			},
			// 申请圈子接口
			shenqing_api(){
				const uid = this.$store.state.memberuid;
                const keycode = this.$store.state.keycode;
				// 如果id为空
				if(!this.id || !this.title || !this.neirong){

					uni.showToast({
						icon: 'none',
						title: '请填写圈子信息'
					});
					return;
				}
				// 上传图片
					let img = '';
					var jtu =this.fileList1;
					jtu.forEach(item=>{
						img+= '&data[thumb]='+item.id;
					})
				var datas = "is_ajax=1&data[title]="+this.title+"&data[content]="+this.neirong+"&catid="+this.id+"&data[jiage]="+this.jiage+img;

				var post_data = postRequest(QuanApi.postShenqing_quan(uid,keycode,this.id),datas);
				var res;
				post_data.then(duixin_data => {
					res = duixin_data;
					console.log('申请圈子接口',res.data.code);
					if(res.data.code==1) {
						// 转换时间戳为日期格式
						//var list = res.data ? res.data.data : {};
						var list = res.data && res.data.data ? res.data.data.lisi2 : [];
						
						
        				this.quan_daohang_list = list;
						//console.log(list);
						//申请成功
						uni.showToast({
							icon: 'success',
							duration: 2000,

							title: res.data.msg || '申请成功，等待审核'
						});
						// 跳转到圈子栏目
						uni.switchTab({
							url: '/pages/quan/index',
							fail: (err) => {
								console.error('跳转失败:', err)
							}
						})


					} else {
						uni.showToast({
							icon: 'none',
							duration: 5000,
							title: res.data.msg || '申请失败，请稍后重试'
						});
					}
				})
			},
			// 新增图片
			async afterRead(event) {
				var duixin = this; 
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
					console.log('event',event); 
					let lists = [].concat(event.file)
					let fileListLen = this[`fileList${event.name}`].length
					lists.map((item) => {
						// 判断文件类型
						const isImage = item.type.startsWith('image/');
						const isVideo = item.type.startsWith('video/');
						
						// 只处理图片和视频文件
						if (isImage || isVideo) {
							this[`fileList${event.name}`].push({
								...item,
								status: 'uploading',
								message: '上传中',
								fileType: isImage ? 'image' : 'video'
							})
						} else {
							uni.showToast({
								icon: 'none',
								title: '不支持的文件类型，请上传图片或视频'
							})
						}
					})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url,1)
					const id = duixin.uptu.data.id;
					console.log('uptu',duixin.uptu.data.id); 
					let item = this[`fileList${event.name}`][fileListLen]
					// 更新文件列表状态
						const updatedItem = Object.assign(item, {
							status: 'success',
							message: '',
							url: result,
							id: id,
							fileType: item.fileType // 保留文件类型信息
						})
						this[`fileList${event.name}`].splice(fileListLen, 1, updatedItem)
						fileListLen++
						
						// 注释掉自动插入逻辑，根据用户需求取消自动插入
						// if (updatedItem.fileType === 'image') {
						// 	this.handleInsertImage({ url: result })
						// } else if (updatedItem.fileType === 'video') {
						// 	this.handleInsertVideo({ url: result })
						// }
					}
			},
			// 删除图片
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			//上传图片
			uploadFilePromise(url,leixing) {
				
				
				var duixin = this; 
				console.log('fabuidjiugetu',duixin.fabuid && duixin.fabuid.jiugetu); 
				const uid = this.$store.state.memberuid;
				const keycode = this.$store.state.keycode;
				
				// 图片上传
				var upid = duixin.fabuid && duixin.fabuid.quan_tubiao;
				

				
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: QuanApi.postTupians(uid,keycode)+'&fid='+upid, //
						filePath: url,
						name: 'file_data',
						formData: {
							is_ajax:1
						},
						success: (res) => {
							var duixin = this; 
							var code = JSON.parse(res.data);
							console.log('code',code.code);
							if(leixing==1){
								duixin.uptu = JSON.parse(res.data);
								//打印duixin.uptu
								console.log('duixin.uptu',duixin.uptu);
								// 假设接口返回的数据中有img_url字段包含图片URL
								// 使用正确的URL路径，并确保传递给handleInsertImage
								const imgUrl = duixin.uptu.data.url || '';
								console.log('服务器返回的图片URL:', imgUrl);
								setTimeout(() => {
									resolve(imgUrl)
								}, 1000)

							} else if(leixing==2){
								duixin.up_shipin = JSON.parse(res.data);
								//打印duixin.uptu
								//console.log('duixin.up_shipin',duixin.up_shipin);
								const shipinUrl = duixin.up_shipin.data.url || '';
								//console.log('服务器返回的图片URL:', shipinUrl);
								setTimeout(() => {
									resolve(shipinUrl)
								}, 1000)
							}
							if(code.code){
								uni.showToast({
									icon: 'success',
									duration: 2000,
									title: code.msg || '上传成功'
								});
							} else {
								console.log('上传失败，正在处理状态...');
								// 上传失败后，清理上传的文件列表项并关闭上传中提示
								try {
									const fileList = this[`fileList${event.name}`];
									if (fileList && Array.isArray(fileList)) {
										const uploadingIndex = fileList.findIndex(item => item.status === 'uploading');
										if (uploadingIndex !== -1) {
											// 先更新文件状态为失败，避免显示上传中
											fileList[uploadingIndex].status = 'failed';
											fileList[uploadingIndex].message = code.msg || '上传失败';
											// 然后从列表中移除该文件项
											fileList.splice(uploadingIndex, 1);
											//console.log('文件列表已成功清理，上传中提示已关闭');
										}
									} else {
										//console.error('无法处理文件状态：fileList不存在或不是数组');
									}
								} catch (error) {
									console.error('处理文件状态时出错:', error);
								}
								uni.showToast({
									icon: 'none',
									title: code.msg || '上传失败'
								});
								//console.log('上传失败:', res.data.msg);
							}
							// 注释掉自动插入逻辑，根据用户需求取消自动插入
						// this.handleInsertImage({url: imgUrl});
							
						}
							
					});
				})
			},
			// 关闭播放音频
			clearAllAudio() {
    		  if(this.$refs.audioPlayer) {
    		    const audioCtx = this.$refs.audioPlayer.getAudioContext();
    		    audioCtx.stop();
    		    audioCtx.destroy();
    		  }
    		},
		//发布id
		getFabuid_api(){
			var duixin = this; 
			var get_data = getRequest(Api.getFabuid());
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						duixin.fabuid = res.data.data;
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})
		},
		//站点设置
		wwwdataget(e){
			this.wwwData = e;
			//console.log('wwwdata',this.wwwdata);
		},
		// 我的圈子
		woquan_url(){
			uni.navigateTo({
				url: '/pages/u/woquan',
				fail: (err) => {
					console.error('跳转失败:', err)
				}
			})
		},
		//个人信息 getu_api() u_data
		getu_api(){
			// console.log('Calling getu_api with uid:', this.uid);
			var uid = this.$store.state.memberuid;
			var keycode = this.$store.state.keycode;
			const data = {
					uid: uid,
					api_auth_uid: uid,
					api_auth_code: keycode,
				}
			var get_data = getRequest(UApi.getU(),data);
			var res;
			get_data.then(duixin_data => {
				res = duixin_data;
				if(res.data.code) {
					if(uid){
						//this.u_data = res.data.data.wo;
					} else {
						//this.u_data = res.data.data.u;
					}
					this.u_data = res.data.data;
					//this.u_data = res.data.data;
					this.dataLoaded = true;
					// 获取申请圈子的数量，
					var shuliang_data = res.data.data && res.data.data.group_data;
					// console.log('申请圈子数量shuliang_data:', shuliang_data);
					// 检查shuliang_data是数组还是对象
					if (Array.isArray(shuliang_data) && shuliang_data.length > 0) {
					    // 如果是数组，按数组方式遍历
					    for (let i = 0; i < shuliang_data.length; i++) {
					        const item = shuliang_data[i];
					        // console.log('申请圈子数量(数组):', item);
					    }
					} else if (shuliang_data && typeof shuliang_data === 'object') {
					    // 如果是对象，按对象方式遍历
					    for (const key in shuliang_data) {
					        if (shuliang_data.hasOwnProperty(key)) {
					            const item = shuliang_data[key];
					           // console.log('申请圈子数量(对象键' + key + '):', item);
							   //console.log('申请圈子数量:', item.yongjin.setting && item.yongjin.setting.level.quan_shuliang);
					        }
					    }
					} else {
					    // console.log('shuliang_data不是有效数组或对象');
					}
					
					
					
					
				}
			})
		
		},
		//vip升级
		vip(){
			uni.navigateTo({
				url: '/pages/u/vip',
				fail: (err) => {
					console.error('跳转失败:', err)
				}
			})
		},
				// 申请的圈子统计
			async getShenqing_uid_list_api(){
				const uid = this.$store.state.memberuid;
			    const keycode = this.$store.state.keycode;
				var get_data = getRequest(QuanApi.getShenqing_uid_list(uid,keycode));
				var res;	
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						var list = res.data? res.data.data[0].list : {};
						var tongji = res.data.data && res.data.data[0].tongji;
						//
						this.shenquan_list = list;	
						//this.shenquan_tongji = tongji;	
						}
					
				})
			},

		}
	}
</script>

<style>

	.content {
		display: flex;
		flex-direction: column;
		/*align-items: center;*/
		/*justify-content: center;*/
		/*background-color: #f3f3f3;*/
		
		margin-bottom: 0px;
		
		box-sizing: border-box;
		overflow-x: hidden;

	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	/* 屏幕宽度大于786px时隐藏uni-page-head */
    @media (min-width: 786px) {
        uni-page-head {
            display: none !important;
            opacity: 0 !important;
            height: 0 !important;
            visibility: hidden !important;
        }
    }
	/*.d-daohang{
		
		width: 600rpx;
	}*/
	/* 添加在style部分 */
	.d-daohang-zuo {
    position: fixed;
    left: 0;
    
    width: 180rpx;
    height: calc(100vh - 70rpx);
    background: #f5f5f5;
    z-index: 100;
	box-shadow: 2px 0 5px rgba(177, 177, 177, 0.1);
  }
  
  .d-daohang-you {
    position: fixed;
    left: 180rpx;
    
    width: 180rpx;
    height: calc(100vh - 70rpx);
    background: #fff;
    z-index: 100;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  }
  .d-erji-item {
    height: 60rpx;
    line-height: 60rpx;
    padding: 0 20rpx;
   /* border-bottom: 1px solid #f0f0f0;*/
  }
  
  .d-erji-item:active {
    background: #f5f5f5;
  }
  .you-guding-1 {
		position: fixed;
		top: 0; /* 根据头部高度调整 */
		/*box-shadow: -2px 0 5px rgba(0,0,0,0.1);*/
		transition: all 0.3s ease;
	}
    .you-guding-2 {
		position: fixed;

		top: 60px; /* 根据头部高度调整 */
		/*box-shadow: -2px 0 5px rgba(0,0,0,0.1);*/
		transition: all 0.3s ease;
	}


	
</style>
